#主函数
import time 
from GA import genetic_algorithm_tsp

if __name__ == "__main__":
    seed = 42
    
    # 参数设置
    num_cities = 200
    population_size = 2000
    elite_size = 100
    mutation_rate = 0.03
    generations = 1000
    ls_intensity=5

    print(f"Solving TSP with {num_cities} cities using Genetic Algorithm...")
    start_time = time.time()
    
    # 运行遗传算法
    best_path, best_distance = genetic_algorithm_tsp(
        seed,
        num_cities,
        population_size,
        elite_size,
        mutation_rate,
        generations,
        ls_intensity
    )
    
    # 计算并打印运行时间
    end_time = time.time()
    print(f"\nExecution Time: {end_time - start_time:.2f} seconds")